<template>
  <div v-if="isDevelopment" class="env-indicator">
    <n-tag :type="envType" size="small">
      {{ envText }}
    </n-tag>
    <span class="env-url">{{ apiBaseUrl }}</span>
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { NTag } from 'naive-ui'
import { getEnv, getApiBaseUrl, isDevelopment } from '../../utils/env'

const env = getEnv()
const apiBaseUrl = getApiBaseUrl()

const envType = computed(() => {
  switch (env) {
    case 'development':
      return 'warning'
    case 'production':
      return 'success'
    default:
      return 'info'
  }
})

const envText = computed(() => {
  switch (env) {
    case 'development':
      return '开发环境'
    case 'production':
      return '生产环境'
    default:
      return env
  }
})
</script>

<style scoped>
.env-indicator {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 8px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-size: 12px;
}

.env-url {
  color: #666;
  font-family: monospace;
}
</style> 